package code.example.javassist.reflect;

import java.beans.BeanInfo;
import java.beans.Introspector;
import java.lang.reflect.Method;

public class ClassReflector {
    private Class classz = null;
    BeanInfo beanInfo  = null;
    public ClassReflector(Class classz){
        this.classz = classz;
    }
    public PropertiesReflector createPropertysReflector() throws Exception {
        if(this.beanInfo == null){
            BeanInfo beanInfo = Introspector.getBeanInfo(this.classz);
            this.beanInfo = beanInfo;
        }
        return new PropertiesReflector(this.beanInfo);
    }
    public MethodsReflector createMethodsReflector() throws  Exception{
        Method[] methods = this.classz.getMethods();
        return new MethodsReflector(methods);
    }
}
